<div class="app-form">
	<form  action="{php echo web_url('dating/vip/vipSee')}" method="post"  class="form-horizontal form-validate">
		<div class="modal-dialog" style="z-index: 50;">
			<div class="modal-content">
				<div class="modal-header">
					<button data-dismiss="modal" class="close" type="button">×</button>
					<h4 class="modal-title">{if $id > 0}编辑{else}新建{/if}会员</h4>
				</div>
				<div class="modal-body" style="margin-left: 100px;">
					<div class="form-group">
						<label class="col-sm-2 control-label"><span style='color:red'>*</span>选择用户</label>
						<div class="col-sm-7">
							{php echo tpl_select_user('data[mid]', $vip['mid']);}
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">会员类型</label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" onclick="$('#type1').show();$('#type2').hide();" value="1" name="data[type]" {if $vip['type'] == 1 } checked="checked" {/if} > 时限卡
							</label>
							<label class="radio-inline">
								<input type="radio" onclick="$('#type2').show();$('#type1').hide();" value="2" name="data[type]" {if $vip['type'] == 2 } checked="checked" {/if} > 次数卡
							</label>
						</div>
					</div>
					<div class="form-group " {if $vip['type'] != 1 } style="display: none;"  {/if}  id="type1">
						<label class="col-sm-2 control-label">过期时间</label>
						<div class="col-md-7">
							{php echo tpl_form_field_date('data[end_time]',date('Y-m-d H:i:s',$vip['end_time']),true);}
						</div>
					</div>
					
					<div class="form-group" {if $vip['type'] != 2 } style="display: none;"  {/if} id="type2">
						<label class="col-sm-2 control-label">总次数</label>
						<div class="col-sm-9">
							<div class="input-group">
								<input type="text" name="data[frequency]" class="form-control" value="{$vip['frequency']}">
								<span class="input-group-addon">次</span>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<input type="hidden" name="id" id="id" value="{$id}" />
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="submit" class="btn btn-primary">提交更改</button>
				</div>
			</div>
		</div>
	</form>
</div>
<script>
	$(document).on('show.bs.modal', '.modal', function(event) {
        $(this).appendTo($('body'));
    }).on('shown.bs.modal', '.modal.in', function(event) {
        setModalsAndBackdropsOrder();
    }).on('hidden.bs.modal', '.modal', function(event) {
        setModalsAndBackdropsOrder();
    });


    function setModalsAndBackdropsOrder() {
        var modalZIndex = 1040;
        $('.modal.in').each(function(index) {
            var $modal = $(this);
            modalZIndex++;
            $modal.css('zIndex', modalZIndex);
            $modal.next('.modal-backdrop.in').addClass('hidden').css('zIndex', modalZIndex - 1);
        });
        $('.modal.in:visible:last').focus().next('.modal-backdrop.in').removeClass('hidden');
    }
</script>
